#ifndef _PATHMNGR_H_
#define _PATHMNGR_H_

#include "singleton.h"
#include "xml.h"
#include <string>

using namespace std;

class pathmngr: public singleton<pathmngr>
{
public:
	pathmngr()
	{
		char path[512];
		memset(path,0,512);
		HMODULE hm = GetModuleHandle(NULL);
		GetModuleFileName(hm,path,512);
		for(int i=511;i>=0;i--)
		{
			if(path[i]=='\\')
			{
				path[i]=0;
				break;
			}
		}
		m_base=string(path)+"\\";
		m_textures = "";
		m_models = "";
		m_fonts = "";
	}
	void init(xml_node& _node)
	{
		m_textures = _node.attr_str("textures","");
		m_models = _node.attr_str("models","");
		m_fonts = _node.attr_str("fonts","");
	}
	
	string get_base(){return m_base;}
	string get_texture(const char* _fname){return m_base + m_textures + "\\" + _fname;}
	string get_model(const char* _fname){return m_base + m_models + "\\" + _fname;}
	string get_font(const char* _fname){return m_base + m_fonts + "\\" + _fname;}
private:
	string m_base;
	string m_textures;
	string m_models;
	string m_fonts;
};

#endif